package transfer;

/**
 * This class represents commodity entity from database. This is used for
 * transferring.
 *
 * @author Vadym Gula
 * @author Oleh Tarapata
 */
public class Commodity {

    private Integer idCommodity;
    private CommodityCategory category;
    private String nameCommodity;
    private Double price;
    private String description;
    private String image;
    private Integer popularity;
    private Boolean outOfProduction;

    public Commodity() {
    }

    public Integer getIdCommodity() {
        return idCommodity;
    }

    public void setIdCommodity(Integer idCommodity) {
        this.idCommodity = idCommodity;
    }

    public CommodityCategory getCategory() {
        return category;
    }

    public void setCategory(CommodityCategory category) {
        this.category = category;
    }

    public String getNameCommodity() {
        return nameCommodity;
    }

    public void setNameCommodity(String nameCommodity) {
        this.nameCommodity = nameCommodity;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public Integer getPopularity() {
        return popularity;
    }

    public void setPopularity(Integer popularity) {
        this.popularity = popularity;
    }

    public Boolean getOutOfProduction() {
        return outOfProduction;
    }

    public void setOutOfProduction(Boolean outOfProduction) {
        this.outOfProduction = outOfProduction;
    }
    
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof Commodity)) {
            return false;
        }
        Commodity c = (Commodity) o;
        if (c.getIdCommodity() == this.getIdCommodity()) {
            return true;
        }
        return false;
    }
    
    public int hashCode() {
        return idCommodity.intValue();
    }
}
